package com.zhiyou100.loans.servlet.withdraw;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zhiyou100.loans.service.WithdrawService;
import com.zhiyou100.loans.service.impl.WithdrawServiceImpl;

import net.sf.json.JSONObject;

@WebServlet("/WithdrawAddServlet")
public class WithdrawAddServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String userid = request.getParameter("userid");
		String money = request.getParameter("money");
		
		WithdrawService ws = new WithdrawServiceImpl();
		JSONObject result=ws.add(money,userid);
		response.getWriter().println(result);
	}

}
